CC=gcc


CFLAGS = -g -Wall

SO_MACRO= -shared -fpic
DEST=libyhsocket.so

SRC=yhsocket.c yhprotocol.c
HED=yhsocket.h yhprotocol.h

$(DEST): $(SRC) $(HED)
	$(CC) $(CFLAGS) $(SO_MACRO) -o $@ $^ \
		&& mkdir -p lib \
		&& mkdir -p include \
		&& cp $(DEST) lib \
		&& cp $(HED)  include

dm_test: dm_svr dm_cli_send dm_cli_sendto

dm_svr: dm_svr.c yhsocket.c
	$(CC) $(CFLAGS) $^ -o $@
dm_cli_send: dm_cli_send.c yhsocket.c
	$(CC) $(CFLAGS) $^ -o $@
dm_cli_sendto: dm_cli_sendto.c yhsocket.c
	$(CC) $(CFLAGS) $^ -o $@

clean:
	rm -rf $(DEST) lib include dm_svr dm_cli_send dm_cli_sendto


